]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
cleanup: "Only" use two indentation styles for object literals
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 12 Feb 2019 14:02:09 +0000 (15:02 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 12 Sep 2019 21:18:24 +0000 (23:18 +0200)
We currently use no less than three different ways of indenting
object literals:

    let obj1 = {
        foo: 42,
        bar: 23,
    };

    let obj2 = { foo: 42,
                 bar: 23 };

    let obj3 = { foo: 42,
                 bar: 23
               };

The first is the one we want to use everywhere eventually, while the
second is the most commonly used "legacy" style.

It is the third one that is most problematic, as it throws off eslint
fairly badly: It violates both the rule to have consistent line breaks
in braces as well as the indentation style of both regular and legacy
configurations.

Fortunately the third style was mostly used for tween parameters, so
is quite rare after the Tweener purge. Get rid of the remaining ones
to cut down on pre-existing eslint errors.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/716

18 files changed:
js/ui/appDisplay.js
js/ui/appFavorites.js
js/ui/background.js
js/ui/components/autorunManager.js
js/ui/components/networkAgent.js
js/ui/dateMenu.js
js/ui/endSessionDialog.js
js/ui/extensionDownloader.js
js/ui/layout.js
js/ui/lightbox.js
js/ui/messageTray.js
js/ui/overview.js
js/ui/popupMenu.js
js/ui/runDialog.js
js/ui/screenShield.js
js/ui/shellMountOperation.js
js/ui/status/network.js
js/ui/viewSelector.js

index 6cc0e154fb140c72fc9c051d786929000f54e057..a9c26ab97fcf9bed2922e314b357830a993ca9b9 100644 (file)
@@ -1158,11 +1158,10 @@ var AppSearchProvider = class AppSearchProvider {
             if (id.endsWith('.desktop')) {
                 let app = this._appSys.lookup_app(id);
 
-                metas.push({ 'id': app.get_id(),
-                             'name': app.get_name(),
-                             'createIcon'(size) {
-                                 return app.create_icon_texture(size);
-                             }
+                metas.push({
+                    id: app.get_id(),
+                    name: app.get_name(),
+                    createIcon: size => app.create_icon_texture(size),
                 });
             } else {
                 let name = this._systemActions.getName(id);
index 36d3d6a7db7cae096bc5fcf1dd99ecad31ca7cb7..8bfebcfc12422d75e95387e03170eb17c268f8c1 100644 (file)
@@ -147,12 +147,11 @@ class AppFavorites {
 
         let app = Shell.AppSystem.get_default().lookup_app(appId);
 
-        Main.overview.setMessage(_("%s has been added to your favorites.").format(app.get_name()),
-                                 { forFeedback: true,
-                                   undoCallback: () => {
-                                       this._removeFavorite(appId);
-                                   }
-                                 });
+        let msg = _("%s has been added to your favorites.").format(app.get_name());
+        Main.overview.setMessage(msg, {
+            forFeedback: true,
+            undoCallback: () => this._removeFavorite(appId),
+        });
     }
 
     addFavorite(appId) {
@@ -181,12 +180,11 @@ class AppFavorites {
         if (!this._removeFavorite(appId))
             return;
 
-        Main.overview.setMessage(_("%s has been removed from your favorites.").format(app.get_name()),
-                                 { forFeedback: true,
-                                   undoCallback: () => {
-                                       this._addFavorite(appId, pos);
-                                   }
-                                 });
+        let msg = _("%s has been removed from your favorites.").format(app.get_name());
+        Main.overview.setMessage(msg, {
+            forFeedback: true,
+            undoCallback: () => this._addFavorite(appId, pos),
+        });
     }
 }
 Signals.addSignalMethods(AppFavorites.prototype);
index babc1e48749a60fb6293875628afce41dc128bb3..8432abc75e9fdc214131d1fa6204154ef4a3d03a 100644 (file)
@@ -441,20 +441,21 @@ var Background = class Background {
     }
 
     _loadAnimation(file) {
-        this._cache.getAnimation({ file: file,
-                                   settingsSchema: this._settings.schema_id,
-                                   onLoaded: animation => {
-                                       this._animation = animation;
-
-                                       if (!this._animation || this._cancellable.is_cancelled()) {
-                                           this._setLoaded();
-                                           return;
-                                       }
+        this._cache.getAnimation({
+            file: file,
+            settingsSchema: this._settings.schema_id,
+            onLoaded: animation => {
+                this._animation = animation;
+
+                if (!this._animation || this._cancellable.is_cancelled()) {
+                    this._setLoaded();
+                    return;
+                }
 
-                                       this._updateAnimation();
-                                       this._watchFile(file);
-                                   }
-                                 });
+                this._updateAnimation();
+                this._watchFile(file);
+            }
+        });
     }
 
     _loadImage(file) {
@@ -748,13 +749,14 @@ var BackgroundManager = class BackgroundManager {
 
     _createBackgroundActor() {
         let background = this._backgroundSource.getBackground(this._monitorIndex);
-        let backgroundActor = new Meta.BackgroundActor({ meta_display: global.display,
-                                                         monitor: this._monitorIndex,
-                                                         background: background.background,
-                                                         vignette: this._vignette,
-                                                         vignette_sharpness: 0.5,
-                                                         brightness: 0.5,
-                                                       });
+        let backgroundActor = new Meta.BackgroundActor({
+            meta_display: global.display,
+            monitor: this._monitorIndex,
+            background: background.background,
+            vignette: this._vignette,
+            vignette_sharpness: 0.5,
+            brightness: 0.5,
+        });
 
         this._container.add_child(backgroundActor);
 
index f1aaaaf36f78a5d11d54c3c21ff2728fd4f00795..013521bafca2ed4ff67fb030396e252fbb315f47 100644 (file)
@@ -325,10 +325,10 @@ var AutorunNotification = class extends MessageTray.Notification {
                                  style_class: 'hotplug-notification-item-icon' });
         box.add(icon);
 
-        let label = new St.Bin({ y_align: St.Align.MIDDLE,
-                                 child: new St.Label
-                                 ({ text: _("Open with %s").format(app.get_name()) })
-                               });
+        let label = new St.Bin({
+            y_align: St.Align.MIDDLE,
+            child: new St.Label({ text: _("Open with %s").format(app.get_name()) }),
+        });
         box.add(label);
 
         let button = new St.Button({ child: box,
index 80691b88a9b83f790f4267c7f8412e6ae00dc2c6..f037ef783b1148bba981d1888c4f90e18a8d628c 100644 (file)
@@ -112,16 +112,17 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
                                         expand: true });
         }
 
-        this._okButton = { label: _("Connect"),
-                           action: this._onOk.bind(this),
-                           default: true
-                         };
-
-        this.setButtons([{ label: _("Cancel"),
-                           action: this.cancel.bind(this),
-                           key: Clutter.KEY_Escape,
-                         },
-                         this._okButton]);
+        this._okButton = {
+            label: _("Connect"),
+            action: this._onOk.bind(this),
+            default: true,
+        };
+
+        this.setButtons([{
+            label: _("Cancel"),
+            action: this.cancel.bind(this),
+            key: Clutter.KEY_Escape,
+        }, this._okButton]);
 
         this._updateOkButton();
     }
@@ -551,11 +552,12 @@ var VPNRequestHandler = class {
                 let shouldAsk = keyfile.get_boolean(groups[i], 'ShouldAsk');
 
                 if (shouldAsk) {
-                    contentOverride.secrets.push({ label: keyfile.get_string(groups[i], 'Label'),
-                                                   key: groups[i],
-                                                   value: value,
-                                                   password: keyfile.get_boolean(groups[i], 'IsSecret')
-                                                 });
+                    contentOverride.secrets.push({
+                        label: keyfile.get_string(groups[i], 'Label'),
+                        key: groups[i],
+                        value: value,
+                        password: keyfile.get_boolean(groups[i], 'IsSecret'),
+                    });
                 } else {
                     if (!value.length) // Ignore empty secrets
                         continue;
@@ -609,10 +611,11 @@ Signals.addSignalMethods(VPNRequestHandler.prototype);
 
 var NetworkAgent = class {
     constructor() {
-        this._native = new Shell.NetworkAgent({ identifier: 'org.gnome.Shell.NetworkAgent',
-                                                capabilities: NM.SecretAgentCapabilities.VPN_HINTS,
-                                                auto_register: false
-                                              });
+        this._native = new Shell.NetworkAgent({
+            identifier: 'org.gnome.Shell.NetworkAgent',
+            capabilities: NM.SecretAgentCapabilities.VPN_HINTS,
+            auto_register: false,
+        });
 
         this._dialogs = { };
         this._vpnRequests = { };
index c78b39c6b3703af73006796bf991f058069e75fd..2c8253481d8009c2c003a1918dbf51b4a6f69cbe 100644 (file)
@@ -30,11 +30,13 @@ var TodayButton = class TodayButton {
         // Having the ability to go to the current date if the user is already
         // on the current date can be confusing. So don't make the button reactive
         // until the selected date changes.
-        this.actor = new St.Button({ style_class: 'datemenu-today-button',
-                                     x_expand: true, x_align: St.Align.START,
-                                     can_focus: true,
-                                     reactive: false
-                                   });
+        this.actor = new St.Button({
+            style_class: 'datemenu-today-button',
+            x_align: St.Align.START,
+            x_expand: true,
+            can_focus: true,
+            reactive: false,
+        });
         this.actor.connect('clicked', () => {
             this._calendar.setDate(new Date(), false);
         });
index 6267152f14a5b237bb1119dff3d02a6c38e1fc65..e1c6517f4691d1151b41c9e5496d8b5c66ff125a 100644 (file)
@@ -449,14 +449,16 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
         for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
             let signal = dialogContent.confirmButtons[i].signal;
             let label = dialogContent.confirmButtons[i].label;
-            buttons.push({ action: () => {
-                               this.close(true);
-                               let signalId = this.connect('closed', () => {
-                                   this.disconnect(signalId);
-                                   this._confirm(signal);
-                               });
-                           },
-                           label: label });
+            buttons.push({
+                action: () => {
+                    this.close(true);
+                    let signalId = this.connect('closed', () => {
+                        this.disconnect(signalId);
+                        this._confirm(signal);
+                    });
+                },
+                label: label,
+            });
         }
 
         this.setButtons(buttons);
index dc67909e822c58f93e3cb7ac506b1effa94b944a..dc3f1d566d58cb6a1919232e0118059ecfe46959 100644 (file)
@@ -186,14 +186,15 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
         this._info = info;
         this._invocation = invocation;
 
-        this.setButtons([{ label: _("Cancel"),
-                           action: this._onCancelButtonPressed.bind(this),
-                           key: Clutter.Escape
-                         },
-                         { label: _("Install"),
-                           action: this._onInstallButtonPressed.bind(this),
-                           default: true
-                         }]);
+        this.setButtons([{
+            label: _("Cancel"),
+            action: this._onCancelButtonPressed.bind(this),
+            key: Clutter.Escape,
+        }, {
+            label: _("Install"),
+            action: this._onInstallButtonPressed.bind(this),
+            default: true,
+        }]);
 
         let content = new Dialog.MessageDialogContent({
             title: _("Download and install “%s” from extensions.gnome.org?").format(info.name),
index 79c51cf5c53c614096ff077189fc0e06d69bd6ec..85bbd24c22abbf9372fcc6d6946cf833939af092 100644 (file)
@@ -238,11 +238,12 @@ var LayoutManager = GObject.registerClass({
                                              reactive: true });
         this.addChrome(this.overviewGroup);
 
-        this.screenShieldGroup = new St.Widget({ name: 'screenShieldGroup',
-                                                 visible: false,
-                                                 clip_to_allocation: true,
-                                                 layout_manager: new Clutter.BinLayout(),
-                                               });
+        this.screenShieldGroup = new St.Widget({
+            name: 'screenShieldGroup',
+            visible: false,
+            clip_to_allocation: true,
+            layout_manager: new Clutter.BinLayout(),
+        });
         this.addChrome(this.screenShieldGroup);
 
         this.panelBox = new St.BoxLayout({ name: 'panelBox',
index 563bd637a2e7dde726baa91136c8ddb7be175f7a..20092cc04994448b506edaf6c916ae8b9b5759c7 100644 (file)
@@ -108,12 +108,13 @@ var RadialShaderEffect = GObject.registerClass({
  */
 var Lightbox = class Lightbox {
     constructor(container, params) {
-        params = Params.parse(params, { inhibitEvents: false,
-                                        width: null,
-                                        height: null,
-                                        fadeFactor: DEFAULT_FADE_FACTOR,
-                                        radialEffect: false,
-                                      });
+        params = Params.parse(params, {
+            inhibitEvents: false,
+            width: null,
+            height: null,
+            fadeFactor: DEFAULT_FADE_FACTOR,
+            radialEffect: false,
+        });
 
         this._container = container;
         this._children = container.get_children();
index eca670b123f77d124b967a05c2ac609c58ce2ea7..f4d52454079b0546489a92a048805c74ae0c809c 100644 (file)
@@ -136,13 +136,14 @@ var FocusGrabber = class FocusGrabber {
 // A notification without a policy object will inherit the default one.
 var NotificationPolicy = class NotificationPolicy {
     constructor(params) {
-        params = Params.parse(params, { enable: true,
-                                        enableSound: true,
-                                        showBanners: true,
-                                        forceExpanded: false,
-                                        showInLockScreen: true,
-                                        detailsInLockScreen: false
-                                      });
+        params = Params.parse(params, {
+            enable: true,
+            enableSound: true,
+            showBanners: true,
+            forceExpanded: false,
+            showInLockScreen: true,
+            detailsInLockScreen: false,
+        });
         Object.getOwnPropertyNames(params).forEach(key => {
             let desc = Object.getOwnPropertyDescriptor(params, key);
             Object.defineProperty(this, `_${key}`, desc);
index f8b603305bd0152d55385b74427e073ebdedd00b..72626cbc0351980a3b7304a6ff4488fdb1038610 100644 (file)
@@ -42,9 +42,10 @@ var ShellInfo = class {
     }
 
     setMessage(text, options) {
-        options = Params.parse(options, { undoCallback: null,
-                                          forFeedback: false
-                                        });
+        options = Params.parse(options, {
+            undoCallback: null,
+            forFeedback: false,
+        });
 
         let undoCallback = options.undoCallback;
         let forFeedback = options.forFeedback;
index 31506dcdfa63c092e598905bb355945f6de1c26a..75f7cae9cebed41b1daec5f9b2594eeb7503f8d8 100644 (file)
@@ -67,12 +67,13 @@ var PopupBaseMenuItem = GObject.registerClass({
     }
 }, class PopupBaseMenuItem extends St.BoxLayout {
     _init(params) {
-        params = Params.parse (params, { reactive: true,
-                                         activate: true,
-                                         hover: true,
-                                         style_class: null,
-                                         can_focus: true
-                                       });
+        params = Params.parse (params, {
+            reactive: true,
+            activate: true,
+            hover: true,
+            style_class: null,
+            can_focus: true,
+        });
         super._init({ style_class: 'popup-menu-item',
                       reactive: params.reactive,
                       track_hover: params.reactive,
@@ -331,9 +332,10 @@ var PopupSwitchMenuItem = GObject.registerClass({
         this._statusBin = new St.Bin({ x_align: St.Align.END });
         this.add(this._statusBin, { expand: true, x_align: St.Align.END });
 
-        this._statusLabel = new St.Label({ text: '',
-                                           style_class: 'popup-status-menu-item'
-                                         });
+        this._statusLabel = new St.Label({
+            text: '',
+            style_class: 'popup-status-menu-item',
+        });
         this._statusBin.child = this._switch;
     }
 
index ea15ea746036ef3348687c90552764a9cb6f4bfd..ea81047658c8162ff9d4bd45453325bb3627c1d2 100644 (file)
@@ -94,9 +94,11 @@ class RunDialog extends ModalDialog.ModalDialog {
 
         this._errorBox.hide();
 
-        this.setButtons([{ action: this.close.bind(this),
-                           label: _("Close"),
-                           key: Clutter.Escape }]);
+        this.setButtons([{
+            action: this.close.bind(this),
+            label: _("Close"),
+            key: Clutter.Escape,
+        }]);
 
         this._pathCompleter = new Gio.FilenameCompleter();
 
index 898e999faa834f394852cda7638df093e66ef89b..ab83f68463fbbb5f3d0845220b5c1956fbfca323 100644 (file)
@@ -429,13 +429,14 @@ var ScreenShield = class {
         this.actor = Main.layoutManager.screenShieldGroup;
 
         this._lockScreenState = MessageTray.State.HIDDEN;
-        this._lockScreenGroup = new St.Widget({ x_expand: true,
-                                                y_expand: true,
-                                                reactive: true,
-                                                can_focus: true,
-                                                name: 'lockScreenGroup',
-                                                visible: false,
-                                              });
+        this._lockScreenGroup = new St.Widget({
+            x_expand: true,
+            y_expand: true,
+            reactive: true,
+            can_focus: true,
+            name: 'lockScreenGroup',
+            visible: false,
+        });
         this._lockScreenGroup.connect('key-press-event',
                                       this._onLockScreenKeyPress.bind(this));
         this._lockScreenGroup.connect('scroll-event',
index 96eed3152f41f04e0a7383cfd7fd54dd8ea3cea4..a8023a2d9d4f881b90d15af972e1bc19e4e5edd8 100644 (file)
@@ -26,9 +26,10 @@ function _setButtonsForChoices(dialog, choices) {
 
     for (let idx = 0; idx < choices.length; idx++) {
         let button = idx;
-        buttons.unshift({ label: choices[idx],
-                          action: () => dialog.emit('response', button)
-                        });
+        buttons.unshift({
+            label: choices[idx],
+            action: () => dialog.emit('response', button),
+        });
     }
 
     dialog.setButtons(buttons);
@@ -387,24 +388,26 @@ var ShellMountPasswordDialog = GObject.registerClass({
             this._rememberChoice = null;
         }
 
-        this._defaultButtons = [{ label: _("Cancel"),
-                                  action: this._onCancelButton.bind(this),
-                                  key: Clutter.Escape
-                                },
-                                { label: _("Unlock"),
-                                  action: this._onUnlockButton.bind(this),
-                                  default: true
-                                }];
-
-        this._usesKeyfilesButtons = [{ label: _("Cancel"),
-                                       action: this._onCancelButton.bind(this),
-                                       key: Clutter.Escape
-                                     },
-                                     { /* Translators: %s is the Disks application */
-                                       label: _("Open %s").format(disksApp.get_name()),
-                                       action: this._onOpenDisksButton.bind(this),
-                                       default: true
-                                     }];
+        this._defaultButtons = [{
+            label: _("Cancel"),
+            action: this._onCancelButton.bind(this),
+            key: Clutter.Escape,
+        }, {
+            label: _("Unlock"),
+            action: this._onUnlockButton.bind(this),
+            default: true,
+        }];
+
+        this._usesKeyfilesButtons = [{
+            label: _("Cancel"),
+            action: this._onCancelButton.bind(this),
+            key: Clutter.Escape,
+        }, {
+            /* Translators: %s is the Disks application */
+            label: _("Open %s").format(disksApp.get_name()),
+            action: this._onOpenDisksButton.bind(this),
+            default: true,
+        }];
 
         this.setButtons(this._defaultButtons);
     }
index 93f95a226c3a7f9e283ff1fe065d923858ee4ed1..930a20ff52d213f73be18153e55abb672b62b517 100644 (file)
@@ -1073,13 +1073,14 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
 
             this._resortItems();
         } else {
-            network = { ssid: accessPoint.get_ssid(),
-                        mode: accessPoint.mode,
-                        security: this._getApSecurityType(accessPoint),
-                        connections: [],
-                        item: null,
-                        accessPoints: [accessPoint]
-                      };
+            network = {
+                ssid: accessPoint.get_ssid(),
+                mode: accessPoint.mode,
+                security: this._getApSecurityType(accessPoint),
+                connections: [],
+                item: null,
+                accessPoints: [accessPoint],
+            };
             network.ssidText = ssidToLabel(network.ssid);
             this._checkConnections(network, accessPoint);
 
index ddf372e1da24abf6703cc750541de9cae39a3512..4ee8f41d6d072bc6a4b8325c320a31773a4c6445 100644 (file)
@@ -309,12 +309,10 @@ var ViewSelector = class {
         if (params.a11yFocus)
             Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon);
         else
-            Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon,
-                                            { proxy: this.actor,
-                                              focusCallback: () => {
-                                                  this._a11yFocusPage(page);
-                                              }
-                                            });
+            Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon, {
+                proxy: this.actor,
+                focusCallback: () => this._a11yFocusPage(page),
+            });
         page.hide();
         this.actor.add_actor(page);
         return page;